package com.maolong.delayedprod.controller;

import com.maolong.delayedprod.domain.Order;
import com.maolong.delayedprod.service.PayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class OrderController {
    @Autowired
    private PayService service;
    @PostMapping("/createOrder")
    public String createOrder(@RequestBody Order order){
        log.info("订单信息{}",order);
        service.creatOrder(order);
        return "ok";
    }
    @GetMapping("/payOrder")
    public String payOrder(Long id){
        log.info("进行订单支付,订单号：{}",id);
        service.payOrder(id);
        return "ok";
    }
}
